Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing Extensions and Drivers /
Chapter 4 - Printing Messages / Printing Messages Reference
Printing Messages / PostScript Imaging Messages


GXPostScriptGetPrinterText

QuickDraw GX sends the GXPostScriptGetPrinterText message to query the printer's data channel and maintain asynchronous two-way communications with a printer. Your override of the GXPostScriptGetPrinterText message must match the following formal declaration:

OSErr MyPostScriptGetPrinterText (Handle printerTextHdl);
printerTextHdl
A handle to the data that is output from the printer's standard output channel. The first long word in the data is treated as the length of the text.
function result
An error code. The value noErr indicates that the operation was successful.
DESCRIPTION
QuickDraw GX sends the GXPostScriptGetPrinterText message to retrieve any data that the printer sends back on the data channel. This message is sent by the default implementation of the GXOpenConnection, GXFreeBuffer, and GXDumpBuffer messages. It informs QuickDraw GX of the current state of a printer. This message is not sent when printed output is directed to a file.

The default implementation of GXPostScriptGetPrinterText message issues a PAPRead call on the currently opened AppleTalk connection. If any text is received, it
is copied into the handle. If there is no text, the length word in the handle is set to 0.

QuickDraw GX allocates a handle to 512 bytes for the status information. You can resize this handle as needed to change the size. The format of the handle is as follows:

{
   long byteCount;
   char data[];
} **handle;
The value of the byteCount field must be less than or equal to the size of the handle.

SPECIAL CONSIDERATIONS
You can partially override the GXPostScriptGetPrinterText message to add special handling to the default implementation. If you are not using a PAP connection, you must totally override this message.

RESULT CODES
gxSegmentLoadFailedErrA required code segment could not be found,
or there was not enough memory to load it.
gxPrUserAbortErrThe user has canceled printing.
The default implementation of the GXPostScriptGetPrinterText message can also return the communications errors that are listed in Table 4-2 on page 4-42.

SEE ALSO
The GXOpenConnection message is described on page 4-131.

The GXDumpBuffer message is described on page 4-142.

The GXFreeBuffer message is described on page 4-143.

An example of using the GXPostScriptGetPrinterText and GXPostScriptScanPrinterText messages is shown in Listing 4-1.

Listing 4-1 Using the GXPostScriptGetPrinterText and GXPostScriptScanPrinterText messages

Handle response;
   /* download the request and flush the buffers */
   anErr = DownloadResource(kPostScriptType, kPaperTrayQueryID);
   nrequire(anErr, DownloadResource);

   /* flush all buffers to the device */
   anErr = Send_GXWriteData(nil, 0);
   nrequire(anErr, FlushBuffers);

   /* wait for a response from the printer */
   response = NewHandleClear(sizeof(long));
   
   anErr = MemError();
   nrequire(anErr, GetResponseBuffer);

   for (;;)
      {
      if (anErr = Send_GXPostScriptGetPrinterText(response))
         break;
      if ((** long **) response) > 0
         {
         if (Munger(response, 4, "*", 1, "", 0) > 0)
            break;
         else
            {
            if (anErr=Send_GXPostScriptScanPrinterText(response))
               break;
            }
         }
      }

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help